﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AUV5.Web.Manage
{
    public partial class Main : PageMasterBase
    {
        public string pid = "";
        public string menuid = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Page.Title = "AUV5信息管理";
            if (!IsPostBack)
            {
                if(Request.Cookies.AllKeys.Contains("p_menu_id"))
                {
                    pid=Request.Cookies["p_menu_id"].Value;
                    Model.Menu menu=BLL.MenuBLL.Instance.GetDetail(pid);
                    if (menu != null)
                    {
                        lbPmenu.Text = menu.MenuName;
                    }
                }
                if (Request.Cookies.AllKeys.Contains("menu_id"))
                {
                    menuid = Request.Cookies["menu_id"].Value;
                    Model.Menu menu=BLL.MenuBLL.Instance.GetDetail(menuid);
                    if (menu != null)
                    {
                        lbMenu.Text = menu.MenuName;
                    }
                }
                bindMainNav();
            }
        }

        //绑定主菜单
        private void bindMainNav()
        {
            IList<Model.Menu> plist = BLL.MenuBLL.Instance.GetMenuByParentID("0");
            repMain.DataSource = plist;
            repMain.DataBind();

            repSide.DataSource = plist;
            repSide.DataBind();
        }
    }
}